﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lambda表达式案例5_多参数_
{
    class Program
    {
        //委托  逛超市
        //delegate int GuangChaoshi(int a, int b);
        //static void Main(string[] args)
        //{
        //    GuangChaoshi gwl = (p, z) => z - (p + 10);
        //    Console.WriteLine(gwl(10, 100) + "");   //打印80，z对应参数b，p对应参数a
        //    Console.ReadKey();
        //}


        /// <summary>
        /// 委托  逛超市
        /// </summary>
        /// <param name="a">花费</param>
        /// <param name="b">付钱</param>
        /// <returns>找零</returns>
        delegate int GuangChaoshi(int a, int b);
        static void Main(string[] args)
        {
            GuangChaoshi gwl = (p, z) =>
            {
                int zuidixiaofei = 10;
                if (p < zuidixiaofei)
                {
                    return 100;
                }
                else
                {
                    return z - p - 10;
                }

            };
            Console.WriteLine(gwl(10, 100) + "");   //打印80，z对应参数b，p对应参数a
            Console.ReadKey();
        }
    }
}
